package main

import (
	"github.com/gin-gonic/gin"
	"github.com/micro/go-micro/registry"
	"github.com/micro/go-micro/web"
	"github.com/micro/go-plugins/registry/consul"
)

func main () {
	//注册 consul
	consulReg := consul.NewRegistry(
		registry.Addrs("127.0.0.1:8500"),
	)
	// gin
	router := gin.Default()
	router.Handle("GET","/",func (content *gin.Context){
		content.String(200,"bcvbbc")
	})

	server := web.NewService(
		web.Name("user"),// 服务名
		web.Address(":8080"),//端口
		web.Handler(router), //路由
		web.Registry(consulReg),// 注册中心
		)
	server.Run()
}
